﻿<?php
	//开启session
	Session_start();
	//定义图片路径
	$path="../public/uploads/";
	//引入配置文件
	include('../public/config.php');
	//连接数据库
	$con=@mysql_connect(HOST,USER,PASS) or die ('连接数据库失败！');
	//选择数据库并设置字符集
	mysql_select_db(DBNAME,$con);
	mysql_set_charset('utf8');
 ?>
		<!--导入头部文件-->
		<?php include('../public/header.php'); ?>
			<!--主体开始-->
			<div id="body">
				
				<div id="focus">
					<div class="focus-left">
						<div class="sign">
						<ul>
			<?php

					//编写sql语句
					$catalog="select name from type where pid=0";
					//执行sql语句
					$cataque=mysql_query($catalog);
					//遍历结果集

						while($catarow=mysql_fetch_assoc($cataque)){
							if($catarow['name']=="广告位")
								{
									echo '';
								}else{
									echo "<li><a href='list.php'>{$catarow['name']}</a></li>";
								}
							}
			?>
						</ul>
						</div>
					</div>
					<div class="focus-right">
						<div class="top">
							<div class="top1"><img src="../public/images/focus_top1.jpg"/></div>
							<div class="top1"><img src="../public/images/focus_top2.jpg"/></div>
							<div class="top1"><img src="../public/images/focus_top3.jpg"/></div>
						</div>
					</div>
				</div>
				<!--商品内容开始-->
				<div class="main">
					<div class="special">
						<div class="special-left">
							<div class="nav">
								<ul>
									<li><a>热销</a></li>
									<li><a>新品</a></li>
									<li><a>流行时尚</a></li>
									<li><a>超值日用</a></li>
								</ul>
							</div>
							<div class="nav_b">
								<div class="nav_top">
									
										<?php
										//编写sql语句
										$showsql="select picname,price,goods from goods where typeid=(select id from type where name='热销')";
										//执行sql语句
										$showque=mysql_query($showsql);
										
										//遍历结果集
										while($showrow=mysql_fetch_assoc($showque)){
											$picname=$path.'s_'.$showrow['picname'];
											echo "<div class='nav_top_d'>";
											echo "<div class='nav_top_pic'><img src='{$picname}' width='80%' height='80%'/></div>";
											echo "<div class='nav_top_text'>{$showrow['goods']}</div><br/>";
											echo "<div><strong class='nav_top_price'>{$showrow['price']}</strong></div>";
											echo "</div>";
										}
										?>

								</div>
							</div>
						</div>				
						<div class="special-right">
							<div class="nav_r">
								<ul>
									<li><a>独家首发</a></li>
									<li><a>礼品汇</a></li>
									<li><a>随便逛逛</a></li>
								</ul>
							</div>
							<div class="right_b">
								<div class="right_b1">
									<div class="b1_pic"></div>
									<div class="text_title">
									佳能IXUS132(银)+4G
									</div>
									<div class="text_main">留住每一刻精彩瞬间!</div>
								</div>
								<div class="right_b2">
									<div class="b2_pic"></div>
									<div class="text_title">步步高vivo Xplay</div>
									<div class="text_main">首发！送价值400元大礼包！即将到货！</div>
								</div>
							</div>
						</div>
					</div>
					<div class="advert"><img src="../public/images/ad1.jpg"/></div>
					
					
					<div class="goods">
						<div class="goods-nav">
							<div class="goods-type">F1 服装饰品</div>
							<div class="nav-l">
								<ul>
									<?php 
									
									//编写sql语句
									$t="select name,id,path from type where pid=(select id from type where name='服装饰品')";
									
									//执行sql语句
									$tpresult=mysql_query($t);
									//解析并遍历
									while($tprow=mysql_fetch_assoc($tpresult)){
									echo "<li><a href='index.php?type={$tprow['path']}&id={$tprow['id']}'>{$tprow['name']}</a></li>";
									}
									?>
								</ul>
							</div>
							<div class="nav-r">
								<div class="brand">热销品牌</div>
								<!--<div class="other"><a>更多品牌>></a></div>-->
							</div>
						</div>
						<div class="goods-bottom">
							<div class="goods-left">
								<?php
									if($_GET['type'] !== '0,1,'){$_GET['id']=11;$_GET['type']='0,1,';}
									//编写sql语句
									$psql="select goods,picname,price,id from goods where typeid in(select id from type where path like '{$_GET['type']}{$_GET['id']},%')";
									//var_dump($psql);die;
									//执行sql语句并返回结果集
									$presult=mysql_query($psql);
									//遍历结果集并显示
								while($prow=mysql_fetch_assoc($presult)){
								echo "<dl class='num'>";
								echo "<dt class='numlist_pic'><img src='{$path}{$prow['picname']}' width='100%' height='100%'/></dt>";
								echo "<dd class='num1_text1'>";
								echo "<div class='text1_l'>";
								echo "<strong>￥{$prow['price']}</strong>";
								echo "</div>";	
										echo "<div class='text1_r'><b><a href='./proinfo.php?goodsid={$prow['id']}'>购买</a></b>";
										echo "</div>";
									echo"</dd>";
								echo "<dd class='num1_text2'><span class='text-b'>{$prow['goods']}</span>";
								echo "</dd>";
								echo "</dl>";
								} ?>
							</div>
							<div class="goods-right">
								<div class="goods-r">
									<div class="right-list1">
											<div class="list-left"></div>
											<div class="list-pic"></div>
											<div class="list-text">
												雅诗兰黛红石榴晚霜50ml</br>
												<strong>￥469</strong>
											</div>
									</div>
									<div style="text-align:center;color:#dbdbdb;">---------------------------------</div>
									<div class="list-right">
										<div class="list-right-txt">SKII护肤精华露(神仙水)75ml
										</div>
										<div style="text-align:center;color:#dbdbdb;">---------------------------------</div>
										<div class="list-right-txt">小蜜蜂柠檬草防蚊液115ml</div>
									</div>
								</div>
									<div class="goods-rb"><img src="../public/images/pic4.jpg"/></div>
							</div>
						</div>
					</div>
					
				<div class="advert2"><img src="../public/images/ad2.jpg"/></div>
				<div class="goods">
						<div class="goods-nav">
							<div class="goods-type">F2 化妆品</div>
							<div class="nav-l">
								<ul>
									<?php
									//var_dump($ttrow);
									//编写sql语句
									$tt="select name,id,path from type where pid=(select id from type where name='化妆品')";
									//执行sql语句
									$ttresult=mysql_query($tt);
									//解析并遍历
									while($ttrow=mysql_fetch_assoc($ttresult)){
									echo "<li><a href='index.php?typett={$ttrow['path']}&idtt={$ttrow['id']}'>{$ttrow['name']}</a></li>";
									}
									?>
								</ul>
							</div>
							<div class="nav-r">
								<div class="brand">热销品牌</div>
							<!--<div class="other"><a>更多品牌>></a></div>-->
							</div>
						</div>
						<div class="goods-bottom">
							<div class="goods-left">
								<?php
									if($_GET['typett']!=='0,2,'){$_GET['typett']='0,2,';}
									//编写sql语句
									$ttsql="select goods,picname,price,id from goods where typeid in(select id from type where path like '{$_GET['typett']}%')";
								//var_dump($ttsql);die;
									//执行sql语句并返回结果集
									$ttresult=mysql_query($ttsql);
									//遍历结果集并显示
								while($ttrow=mysql_fetch_assoc($ttresult)){
								//var_dump($ttrow);die;
								echo "<dl class='num'>";
								echo "<dt class='numlist_pic'><img src='{$path}{$ttrow['picname']}' width='100%' height='100%'/></dt>";
								echo "<dd class='num1_text1'>";
								echo "<div class='text1_l'>";
								echo "<strong>￥{$ttrow['price']}</strong>";
								echo "</div>";	
										echo "<div class='text1_r'><b><a href='./proinfo.php?goodsid={$ttrow['id']}'>购买</a></b>";
										echo "</div>";
									echo"</dd>";
								echo "<dd class='num1_text2'><span class='text-b'>{$ttrow['goods']}</span>";
								echo "</dd>";
								echo "</dl>";
								} ?>
							</div>
							<div class="goods-right">
								<div class="goods-r">
									<div class="right-list1">
											<div class="list-left"></div>
											<div class="list-pic"></div>
											<div class="list-text">
												雅诗兰黛红石榴晚霜50ml</br>
												<strong>￥469</strong>
											</div>
									</div>
									<div style="text-align:center;color:#dbdbdb;">---------------------------------</div>
									<div class="list-right">
										<div class="list-right-txt">SKII护肤精华露(神仙水)75ml
										</div>
										<div style="text-align:center;color:#dbdbdb;">---------------------------------</div>
										<div class="list-right-txt">小蜜蜂柠檬草防蚊液115ml</div>
									</div>
								</div>
									<div class="goods-rb"><img src="../public/images/pic4.jpg"/></div>
							</div>
						</div>
					</div>
				<!--商品内容结束-->
				
				<!--热卖开始-->
				<div id="hot">
					<div class="hot-title">
						<strong>TOP</strong>
						<b>精选热卖</b>
					</div>
					<!--<div class="hot-pic">-->
						<ul class="hot-pic">
						</ul>
					<!--</div>-->
				</div>
				<!--热卖结束-->
			</div>
			<!--主体结束-->
			
	<!--导入尾部文件-->
	<?php include('../public/footer.php'); ?>